﻿using Nancy;
using Nancy.Bootstrapper;
using Nancy.Conventions;
using Nancy.TinyIoc;
using System;

namespace FastLotWeb
{
   public class CustomBootstrapper: DefaultNancyBootstrapper
    {
        public CustomBootstrapper()
        {

        }


        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            //container.Register()
            base.ApplicationStartup(container, pipelines);
        }



        protected override IRootPathProvider RootPathProvider
        {

            get { return new CustomRootPathProvider(); }
        }

        protected override void ConfigureApplicationContainer(TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);

        }

        protected override void RequestStartup(TinyIoCContainer container, IPipelines pipelines, NancyContext context)
        {
            base.RequestStartup(container, pipelines, context);
        }

        protected override void ConfigureConventions(NancyConventions nancyConventions)
        {
            base.ConfigureConventions(nancyConventions);
            nancyConventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("/", @"FastIotwebPage"));
        }
    }

    public class CustomRootPathProvider : IRootPathProvider
    {
        public string GetRootPath()
        {
            return Environment.CurrentDirectory;
        }
    }
}